package org.travel.app.controller;

import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.travel.app.common.vo.ResultVO;
import org.travel.app.entity.user.User;
import org.travel.app.entity.user.UserSpotsStart;
import org.travel.app.service.impl.UserServiceImpl;

/**
 * @author nmm
 * @date 2024-12-2024/12/29
 * @deriction njm......
 */
@RestController
@RequestMapping("/userMsg")
@RequiredArgsConstructor
public class UserController extends BaseController{
        private final UserServiceImpl userService;
    @PostMapping("/getUserCountMsg")
    public ResultVO getUserCountMsg(@RequestBody User user) {
       	    return success( userService.getUserCountMsg(user.getUserId()));
    }


    /**
     * 修改收藏状态
     * @param userSpotsStart
     * @return
     */
    @PostMapping("/updateSpotsStart")
    public ResultVO updateSpotsStart(@RequestBody UserSpotsStart userSpotsStart) {
            userService.checkIsStart(userSpotsStart);
           return  success();
    }

    /**
     * 用于当前商品判断是否收藏
     * @param userSpotsStart
     * @return
     */
    @PostMapping("/isHaveStartSpots")
    public ResultVO isHaveStartSpots(@RequestBody UserSpotsStart userSpotsStart) {
        return success(userService.isHaveStartSpots(userSpotsStart));
    }

    /**
     * 获取用户收藏景点列表
     * @param user
     * @return
     */
    @PostMapping("/getUserStartSpots")
    public ResultVO getUserStartSpots(@RequestBody User  user) {
        return success(userService.getStartSpots(user.getUserId()));
    }

}